package com.hmjk.health.util;

import java.util.ArrayList;

public class BloodPressureData {
	
	public long upTime = 0;
	public String tid;
	public String subcode;
	
	public ArrayList<BP_DETAIL> list = new ArrayList<BP_DETAIL>();
	
	public static class BP_DETAIL {
		public int sbp;
		public int dbp;
		public int pulse;
		public long recordtime;
		
		public BP_DETAIL(int sbpValue, int dbpValue, int pulseValue, long time){
			sbp = sbpValue;
			dbp = dbpValue;
			pulse = pulseValue;
			recordtime = time;
		}
		
		@Override
		public String toString() {
			// TODO Auto-generated method stub
			return ("BP_DETAIL(recordtime:" + recordtime + ",sbp:" + sbp + ",dbp:" + dbp + ",pulse:" + pulse + ")");
		}
	}
	
	public BloodPressureData(String _tid,String _subcode){
		this.tid = _tid;
		this.subcode = _subcode;
	}
	
	public ArrayList<BP_DETAIL> getDataList(){
		return list;
	}
	
	public void insertItem(BP_DETAIL item){
		list.add(0, item);
	}
	
	public boolean isEmpty(){
		if(list.size() == 0)
			return true;
		else
			return false;
	}
	
	public int getListSize(){
		return list.size();
	}
	
	public BP_DETAIL getLatestBpvalue(){
		BP_DETAIL bp = null;		
		if(list.size() > 0){
			bp = list.get(list.size() - 1);
		}
		return bp;
	}
	
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return ("BP_DETAIL(upTime:" + upTime + ",tid:" + tid + ",subcode:" + subcode + ",list.size:" + list.size() + ")");
	}

}
